<template>
    <div>
      <div class="logo">
        <van-image
          width="150px"
          height="150px"
          fit="contain"
          :src="logoImage"

        />
      </div>
      <van-cell-group>
        <van-field
          v-model="username"
          required
          clearable
          label="用户名"
          right-icon="question-o"
          placeholder="请输入用户名"
          @click-right-icon="$toast('question')"
        />

          <van-field
            v-model="password"
            type="password"
            label="密码"
            placeholder="请输入密码"
            required
          />
      </van-cell-group>
      <van-button type="primary" size="large" @click="handleLogin">登录</van-button>
    </div>
</template>

<script>
  export default {
    name: "index",
      data(){
       return{
         logoImage:require('../../../public/image/logo.png'),
         username:'admin',
         password:'admin',
       }
      },
    methods:{
      handleLogin() {
        this.$store.dispatch("LoginByUsername", {
          tenantId:'000000',
          username:this.username,
          password:this.password,
          grant_type:'password',
          scope:'all',
          type:'account'
        }).then(() => {
          this.$router.push({ path: '/home' });
        }).catch(() => {
        });
      }
    }
  }
</script>

<style scoped lang="less">
  .logo{
    display: flex;
    justify-content: center;
  }
</style>